import request from '/@/utils/request';

export function roomList(query?: Object) {
    return request({
        url: '/room/room/page',
        method: 'get',
        params: query,
    });
}

export function getBuildingList(){
    return request({
        url: '/room/room/getBuilding',
        method: 'get',
    });
}

export function getUnitList(buildingId?: Number) {
    return request({
        url: '/room/room/getUnit',
        method: 'get',
        params: { buildingId }
    });
}

export function getFloorList(unitId?: Number) {
    return request({
        url: '/room/room/getFloor',
        method: 'get',
        params: { unitId }
    });
}

export function getResidentList(roomId: Number) {
    return request({
        url: '/room/room/getResident',
        method: 'get',
        params: { roomId }
    });
}

export function getUnResidentList(query?: Object) {
    return request({
        url: '/room/room/getUnResident',
        method: 'get',
        params: query,
    });
}

export function deleteResident(ids: Number[], roomId: Number) {
    return request({
        url: '/room/room/deleteResident',
        method: 'delete',
        params: { ids, roomId },
    });
}

export function addResident(ids: Number[], roomId: Number) {
    return request({
        url: '/room/room/addRelativeResident',
        method: 'get',
        params: { ids, roomId },
    });
}

export function getRoom(roomId?: Number) {
    return request({
        url: '/room/room/getRoom',
        method: 'get',
        params: { roomId }
    });
}

export function addRoom(data: any) {
    return request({
        url: '/room/room/addRoom',
        method: 'post',
        data: data,
    });
}

export function deleteRoom(ids: Number[]) {
    return request({
        url: '/room/room/deleteRoom',
        method: 'delete',
        params: { ids },
    });
}

export function updateRoom(data: any) {
    return request({
        url: '/room/room/updateRoom',
        method: 'put',
        data: data,
    });
}
